package com.nsl.my_youlai.controller;

import com.nsl.my_youlai.common.model.ElSelectOption;
import com.nsl.my_youlai.common.result.Result;
import com.nsl.my_youlai.service.SysDictService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/api/v1/dict")
@RequiredArgsConstructor
public class SysDictController {

    private final SysDictService dictService;

    @GetMapping("/{typeCode}/options")
    public Result<List<ElSelectOption>> listDictOptions(
             @PathVariable String typeCode
    ) {
        List<ElSelectOption> list = dictService.listDictOptions(typeCode);
        return Result.success(list);
    }
}
